<template>
  <div class="app-container">
    <div>
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>管理员审核</span>
        </div>
        <el-input type="text" v-model="form.checkRemark" placeholder="请输入意见" style="width: 80%" />
      </el-card>
    </div>

    <div slot="footer" v-if="form.activityStatus==1" class="dialog-footer" style="margin-top: 20px">
      <el-button
        style="float: right"
        type="primary"
        @click="ispass('2')"
        >审核通过</el-button
      >
      <el-button
        style="float: right; margin-right: 20px"
        type="primary"
        @click="ispass('3')"
        >审核拒绝</el-button
      >
    </div>
  </div>
</template>

<script>
import { checkActivity, GetUserList, GetActivityDetail } from '@/api/activity';
import CommonUtils from '@/utils/CommonUtils';
import CKEditor from 'ckeditor4-vue';
import { mapGetters } from 'vuex';
import router from '@/router';
export default {
  //   name: 'TeamExamine',
  props: {
    detail: {
      type: Object,
      default: () => ({}),
    },
    managerType:{
      type:String,
    },
  },
  components: {
    ckeditor: CKEditor.component,
  },
  computed: {
    ...mapGetters(['name', 'userName']),
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 表单参数
      form: {
        overCheckRemark:"",
      },
      teamId: '',
      editorConfig0: {
        readOnly: true,
      },
      purpose: '',
    };
  },
  created() {
    // this.form.checkRemark = this.detail.checkRemark;
    this.init();
    this.getList()
  },
  methods: {
    getList(){
      GetActivityDetail(this.detail.activityId).then(res=>{
        console.log(res);
        this.form = res.data;
        console.log(this.form.checkRemark);
      })
    },
    /** 查询团队列表 */
    init() {
      const id = CommonUtils.getCurTeamInfo().id;
      this.teamId = id;
    },
    ispass(no) {
      var ispassVal = !!this.form.checkRemark;
      if (no == '2' || ispassVal) {
        //   this.form.activityId = this.detail.activityId;
        // this.form.activityStatus = no;
        let data = {
          checkRemark:this.form.checkRemark,
          activityStatus:no,
          activityId:this.detail.activityId
        }
        console.log(data);
        this.$confirm('确认提交审核？', '提示', { type: 'warning' }).then(() => {
          checkActivity(data).then(response => {
            if (response.code === 200) {
              this.$modal.msgSuccess('审核成功');
              // this.$router.go(1)
              this.getList()
            }
          });
        });
      } else {
        this.$modal.msgError('请先填写意见');
      }
    },
  },
};
</script>
